(function(){
var tm='<div class="aw-page" v-if="page_all!=0">'+
	'<ul>'+
		'<li class="prev" v-if="page_this!=1">'+
			'<a href="javascript:;" v-on:click="Click_Page(page_this-1)">上一页</a>'+
		'</li>'+
		'<li v-for="index in indexs" v-bind:class="{ active: page_this ==index}">'+
			'<a href="javascript:;" v-on:click="Click_Page(index)">{{index}}</a>'+
		'</li>'+
		'<li class="next" v-if="page_this!=page_all && page_all!=0">'+
			'<a href="javascript:;" v-on:click="Click_Page(page_this+1)">下一页</a>'+
		'</li>'+
	'</ul>'+
'</div>';
var vuePage=Vue.extend({
	template:tm,
	props:{
		page_this:{//当前页
			type:[String,Number],
			required:true
		},page_all:{//所有页数
			type:[String,Number],
			required:true
		},page_item:{//每页条数
			type:[String,Number],
			required:true
		},Call_back:{
			default(){
				return function Call_back(){
	            // todo
				}
			}
		}
	},computed:{
		indexs(){
			var left=1;
			var right=this.page_all;
			var ar=[] ;
			if(this.page_all>=8){
				if(this.page_this>4&&this.page_this<this.page_all-3){
					left=this.page_this-4;
					right=this.page_this+3;
				}else{
					if(this.page_this<=4){
						left=1;
						right=8;
					}else{
						right=this.page_all;
						left=this.page_all-7;
					}
				}
			}
			while(left<=right){
				ar.push(left);
				left++;
			}   
			return ar;
		}
	},methods:{
		Click_Page(page){
			if(page!=this.page_this){
				this.Call_back(page);
			}
		}
	}
});
window.Vpage=vuePage
})()